package com.heima.comment.controller.v1;

import com.heima.comment.service.CommentRepayService;
import com.heima.model.comment.dtos.CommentRepayLikesDto;
import com.heima.model.comment.dtos.CommentRepayPageDto;
import com.heima.model.comment.dtos.CommentRepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/api/v1/comment_repay")
@Slf4j
public class CommentRepayController {

    @Autowired
    private CommentRepayService commentRepayService;

    /**
     * 保存用户评论回复
     * @param commentSaveDto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult commentSave(@RequestBody CommentRepaySaveDto commentSaveDto){
        return commentRepayService.commentSave(commentSaveDto);
    }

    /**
     * 查询评论回复列表：
     * @param commentPageDto
     * @return
     */
    @PostMapping("/load")
    public ResponseResult commentPage(@RequestBody CommentRepayPageDto commentPageDto){
        return commentRepayService.commentPage(commentPageDto);
    }

    /**
     * 评论回复点赞
     * @param commentLikesDto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult commentLikes(@RequestBody CommentRepayLikesDto commentLikesDto){
        return commentRepayService.commentLikes(commentLikesDto);
    }
}
